package com.lzy.cloud.ticket.train.servcie.impl;

import com.lzy.cloud.ticket.train.dtos.TrainInsuranceDto;
import com.lzy.cloud.ticket.train.entity.TrainInsurance;
import com.lzy.cloud.ticket.train.mapper.TrainInsuranceMapperExt;
import com.lzy.cloud.ticket.train.servcie.TrainInsuranceService;
import com.lzy.framework.core.utils.DozerUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by WIN7 on 2018/6/1.
 */
@Service
public class TrainInsuranceServiceImpl implements TrainInsuranceService {

    @Autowired
    TrainInsuranceMapperExt  trainInsuranceMapperExt;

    @Override
    public boolean createTrainInsurance(TrainInsuranceDto trainInsuranceDto) {
        return trainInsuranceMapperExt.insertSelective(DozerUtils.map(trainInsuranceDto, TrainInsurance.class))>0;
    }

    @Override
    public boolean updateTrainInsurance(TrainInsuranceDto trainInsuranceDto) {
        return trainInsuranceMapperExt.updateByPrimaryKeySelective(DozerUtils.map(trainInsuranceDto, TrainInsurance.class))>0;
    }
}
